#include<stdio.h>
 struct ListNode {
    int val;
    struct ListNode *next;
 };
struct ListNode* middleNode0(struct ListNode* head){
    struct ListNode *cur=head;
    int cnt=0;
    while(cur)
    {
        cur=cur->next;
        cnt++;
    }
    cur=head;
    cnt/=2;
    while(cnt)
    {
        cnt--;
        cur=cur->next;
    }
    return cur;
}
struct ListNode* middleNode1(struct ListNode* head){
    struct ListNode *slow=head;
    struct ListNode *fast=head;
    while(fast)
    {
        fast=fast->next->next;
        slow=slow->next;
    }
    return slow;
}